package com.ms.service.module.analysis;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public enum GameNameWithHallType {

	/** 大廳 */
	LOBBY("大廳"),
	
	/**
	 * 百家樂
	 */
	BACR_TABLE_GM("百家樂_GM桌"),
	BACR_TRIAL_01("百家樂_體驗館01"),	
	BACR_TABLE_01("百家樂_正式桌01"),
	BACR_TABLE_02("百家樂_正式桌02"),
	BACR_TABLE_03("百家樂_正式桌03"),
	BACR_TABLE_04("百家樂_正式桌04"),
	BACR_TABLE_05("百家樂_正式桌05"),
	BACR_TABLE_06("百家樂_正式桌06"),
	
	/**
	 * 捕鱼
	 */
	FISH_TABLE_GM("捕鱼_GM桌"),
	FISH_TABLE_01("捕鱼_正式桌01"),
	
	
	;

	/** log object */
	private static final Log log = LogFactory.getLog(GameNameWithHallType.class);

	private String nameString;

	private GameNameWithHallType(String name) {
		this.nameString = name;
	}

	public String getNameString() {
		return nameString;
	}

	public void setNameString(String nameString) {
		this.nameString = nameString;
	}

	public static GameNameWithHallType getENUMbyString(String gameName, String hallType) {
		if (gameName.equalsIgnoreCase(LOBBY.name())) {
			return LOBBY;
		}

		try {
			GameNameWithHallType result = GameNameWithHallType.valueOf(gameName + "_" + hallType);
			return result;
		} catch (Exception e) {
			if (log.isErrorEnabled()) {
				log.error("Illegal GameNameWithHallType : " + gameName + " / " + hallType);
			}
			return null;
		}
	}

	public String getGameType() {
		return this.name().split("_")[0];
	}
}
